package top.atluofu.report.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.atluofu.report.bean.SqlQuery;
import top.atluofu.report.service.CreateTableService;

/**
 * @ClassName: CreateTableController
 * @description: TODO
 * @author: 有罗敷的马同学
 * @datetime: 2023Year-05Month-12Day-23:33
 * @Version: 1.0
 */
@RestController
@RequestMapping("/report")
public class CreateTableController {
    @PostMapping("createClickHouseTable")
    public String createClickHouseTable(@RequestBody SqlQuery sqlQuery) throws Exception {
        return CreateTableService.createClickHouseTable(sqlQuery.getSql());
    }

    @PostMapping("createMySQLTable")
    public String createMySQLTable(@RequestBody SqlQuery sqlQuery) throws Exception {
        return CreateTableService.createMySQLTable(sqlQuery.getSql());
    }
}
